package com.smmisia.article.entity.convetor;

import com.smmisia.article.dto.article.ArticleDTO;
import com.smmisia.article.dto.article.ArticleHotResponse;
import com.smmisia.article.dto.article.ArticleUpdateDTO;
import com.smmisia.article.entity.Article;
import com.smmisia.article.es.entity.ArticleES;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 用户转换器
 * @author smmisia
 * @date 2023/7/27
 */
@Mapper(nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface ArticleConvertor {

    ArticleConvertor INSTANCE = Mappers.getMapper(ArticleConvertor.class);

    public static final int DEFAULT_MIN_SALE_TIME = 60;

    /**
     * Article
     * @param updateDTO
     * @return
     */
    public Article mapToArticle(ArticleUpdateDTO updateDTO);

    /**
     * ArticleDTO
     * @param article
     * @return
     */
    public ArticleDTO mapToArticleDTO(Article article);

    ArticleHotResponse mapToArticleHotResponse(Article article);

    List<Article> mapToEntity(List<ArticleES> articleESList);

}